// src/stores/userStore.ts
import { defineStore } from 'pinia';

// 定义用户信息的类型
interface User {
    username: string;
    password: string;
}

// 定义用户存储
export const useUserStore = defineStore('user', {
    state: (): { users: User[] } => ({
        users: [],
    }),
    actions: {
        // 注册用户的方法
        registerUser(username: string, password: string) {
            const newUser: User = {
                username,
                password,
            };
            this.users.push(newUser);
            console.log('用户注册成功:', newUser);
        },
    },
});